﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BestLifePOS_Core.DomainObjects;
using System.IO;
using BestLifePOS_Core.Data.Fascade;

namespace BestLifePOS_PresentationLayer
{
    public partial class frm_Login : Form
    {
        
        #region Globel Variables

        string GvterminalNo = "";
        string GvBranchName = "";
        string GvTest = "Test1";

        #endregion

        public frm_Login()
        {
            InitializeComponent();
        }


        //private User CollectUserFigures()
        //{

        //}

        private void frm_Login_Load(object sender, EventArgs e)
        {

        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            #region Get Branch Code And Terminal/Split-<Globel variables-->GvterminalNo And GvBranchName >

            //string LvLinerecode = "";
            //TextReader reader = File.OpenText(@"C:\tr\terminal.txt");
            //LvLinerecode = reader.ReadLine();
            //string[] words = LvLinerecode.Split('-');

            //GvterminalNo = words[0].ToString();
            //GvBranchName = words[1].ToString();

            GvterminalNo = "1";
            GvBranchName = "2";

            #endregion

            #region login
            string Lvusername = txtUsernametest.Text;
            string Lvpassword = txtPassword.Text;


            if (!(Lvusername.Equals("")) && !(Lvpassword.Equals("")))
            {

                List<User> lvuserdetails = new List<User>();
                if ((UserDAO.Getuserbyuserid(Lvusername, Lvpassword)) != null)
                {
                    lvuserdetails = UserDAO.Getuserbyuserid(Lvusername, Lvpassword);
                    frmshiftchangemenu Lvfrmshift = new frmshiftchangemenu(lvuserdetails, GvterminalNo, GvBranchName);
                    Lvfrmshift.Show();
                }
                else
                {
                    MessageBox.Show("Username/Password Is incorrect !!", "Warning", MessageBoxButtons.OK);

                }

            }
            else
            {
                MessageBox.Show("Fill Username And Password Correctly !!", "Warning", MessageBoxButtons.OK);

            }

            #endregion

        }

        //private void frm_Login_Load(object sender, EventArgs e)
        //{

        //}


    }
}
